package com.lsh.oms.provider.service.order;

import com.alibaba.dubbo.config.annotation.Service;
import com.alibaba.dubbo.rpc.protocol.rest.support.ContentType;
import com.lsh.base.common.model.CommonResult;
import com.lsh.oms.api.model.order.delivery.OrderSendHeadDTO;
import com.lsh.oms.api.service.order.IOrderDeliveryRestService;
import com.lsh.oms.core.service.order.OrderDeliveryService;
import com.lsh.oms.provider.service.rpc.OrderDeliveryRpcServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
 * Project Name: lsh-oms
 *
 * @author peter
 * @date 18/6/23
 * 北京链商电子商务有限公司
 * Package
 * desc:
 */
@Service(protocol = "rest", timeout = 30000)
@Path("order/delivery/pms")
@Consumes({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
@Produces({ContentType.APPLICATION_JSON_UTF_8, ContentType.TEXT_XML_UTF_8})
@Slf4j
@Deprecated
public class OrderDeliveryRestServiceImpl implements IOrderDeliveryRestService {

    @Autowired
    private OrderDeliveryRpcServiceImpl orderDeliveryRpcService;

    @Autowired
    private OrderDeliveryService orderDeliveryService;

    @POST
    @Path("create")
    @Override
    public CommonResult<Object> create(OrderSendHeadDTO orderSendHeadDTO) {

        return orderDeliveryRpcService.create(orderSendHeadDTO);
    }

//    @POST
//    @Path("update/delivery")
//    @Override
//    public CommonResult<Object> updateDriverInfo2ext(OrderSendUpdateHeadDTO orderSendUpdateHeadDTO) {
//
//        CommonResult<Object> commonResult = new CommonResult<>();
//
////        String logSign = "添加或修改配送员信息";
////        try {
////            if (orderSendUpdateHeadDTO == null) {
////                throw new BusinessException(ReturnCode.REQUEST_PARAMS_IS_NULL, logSign + "请求参数不合法，请检验。");
////            }
////
////            log.info(logSign + ":【参数】 －－ {} ", JsonUtils.obj2Json(orderSendUpdateHeadDTO));
////
////            if(this.orderDeliveryService.updateDriverInfo2ext(orderSendUpdateHeadDTO)){
////                commonResult.setCode(ReturnCode.REQUEST_SUCCESS);
////                commonResult.setData(true);
////            }else{
////                commonResult.setCode(ReturnCode.REQUEST_FAIL);
////                commonResult.setData(false);
////            }
////        } catch (BusinessException e) {
////            commonResult.setCode(e.getCode());
////            commonResult.setMessage(e.getMessage());
////            log.error("业务异常code : " + e.getCode() + ",异常信息: " + e.getMessage(), e);
////        } catch (Exception e) {
////            commonResult.setCode(ExceptionStatus.E3001001.getCode());
////            commonResult.setMessage(ExceptionStatus.E3001001.getMessage());
////            log.error("业务异常code : " + ExceptionStatus.E3001001.getCode() + ",异常信息: " + e.getMessage(), e);
////        }
//
//        return commonResult;
//    }

}
